package com.buercorp.wangyu.file;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Writer;

/**
 * FileOutputStream
 * 续写 true
 *         FileOutputStream fos = new FileOutputStream("D:\\DevelopSpace\\IdeaSpace\\wy-test-demo\\java2.txt",true);
 * 换行写
 *          String wrap = "\r\n";
 *         fos.write(wrap.getBytes());
 * @author liyiyu
 */
public class FileTest6 {
    public static void main(String[] args) throws IOException {
        // 创建对象 true 续写
        FileOutputStream fos = new FileOutputStream("src/main/resources/filejava/java2.txt",true);
        // 写入数据
        String str = "liyiyu";
        fos.write(str.getBytes());

        // 换行
        String wrap = "\r\n";
        fos.write(wrap.getBytes());

        // 写入数据
        String str2 = "666";
        fos.write(str2.getBytes());

        // 释放资源
        fos.close();
    }
}
